package com.sabeot.library.hibernate.dto;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.MapsId;
import javax.persistence.Table;

@Entity
@Table(name = "app_addresses",schema="library")
public class Address extends BasicDTO {

	@Column(name = "street", nullable = false)
	String street;
	
	@Column(name = "street_no", nullable = false, length=5)
	Integer streetNumber;
	
	@Column(name = "home_no", nullable = true, length=5)
	String homeNumber;
	
	@Column(name = "postal_code", nullable = false, length=10)
	String postalCode;
	
	@Column(name = "city", nullable = false, length = 100)
	String city;
	
	@Column(name = "country", nullable = false, length = 100)
	String country;

	@Column(name = "main", nullable = false)
	Boolean isMain;
	
	@ManyToOne
	@JoinColumn(name="user_det_id")
	@MapsId
	UserDetails userDetails;
	
	/*
	 * TO-DO: dorobic typ adresu - wczesniej stworzyc słownik, gdzie wszelkie typy będą przechowywane!
	 * 
	 */
	
	/*
	 * Getters and Setters
	 */
	
	public String getStreet() {
		return street;
	}

	public void setStreet(String street) {
		this.street = street;
	}

	public Integer getStreetNumber() {
		return streetNumber;
	}

	public void setStreetNumber(Integer streetNumber) {
		this.streetNumber = streetNumber;
	}

	public String getHomeNumber() {
		return homeNumber;
	}

	public void setHomeNumber(String homeNumber) {
		this.homeNumber = homeNumber;
	}

	public String getPostalCode() {
		return postalCode;
	}

	public void setPostalCode(String postalCode) {
		this.postalCode = postalCode;
	}

	public String getCity() {
		return city;
	}

	public void setCity(String city) {
		this.city = city;
	}

	public String getCountry() {
		return country;
	}

	public void setCountry(String country) {
		this.country = country;
	}

	public Boolean getIsMain() {
		return isMain;
	}

	public void setIsMain(Boolean isMain) {
		this.isMain = isMain;
	}

	public UserDetails getUserDetails() {
		return userDetails;
	}

	public void setUserDetails(UserDetails userDetails) {
		this.userDetails = userDetails;
	}
	
	
	
}
